﻿#region Header

/***************************************************************************
Author : Krishan Kaliraman (www.sharedwith.me)  Date: 1 Aug 2012
***************************************************************************/

#endregion Header
using System.Collections.Generic;

namespace Common
{
    public class DailyStatusEmail
    {
        private static readonly string WiqlQuery = @"SELECT [System.Id],[System.AssignedTo], [System.WorkItemType], [System.State], [System.AssignedTo], [System.Title] FROM WorkItems WHERE 
                                    [System.TeamProject] = 'advantage' and [System.NodeName]='" + StaticItems.NodeName + "' and [System.IterationPath]=  '" + StaticItems.CurrentSprintIteration + "' ORDER BY [System.WorkItemType], [System.Id]";

        public static void SendDailyStatusEmail(List<Activity> allCommittedWorkItemsForSprintWithTheirTasksLists,QuoteOfTheDay quote=null)
        {
            var workItems = Helper.GetWorkItems(WiqlQuery);
            Helper.FilterWorkItemsForAllTeamMembers(StaticItems.TotalWorkItemsUpdated, StaticItems.TotalWorkItemsInPipeLineForCurrentSprint, workItems);
            Helper.FillTeamMembersAndActivities(StaticItems.TotalWorkItemsUpdated, StaticItems.allTeamMembers);
            Helper.SendStatusEmail(StaticItems.AllTeamMembersCollection, StaticItems.allTeamMembers,allCommittedWorkItemsForSprintWithTheirTasksLists ,quote );
        }
    }
}
